<?php
session_start();
require_once"../admin/conexao.jsp";

       $request= strtoupper($_REQUEST["search"]);
       $tabela = $_REQUEST["tabela"];
       $cod    = $_REQUEST["cod"];
       $nome   = $_REQUEST["nome"];
       
       $request = explode("?", $request);
       $request = $request[0];

function live($request, $tabela, $cod, $nome){


        $sql = "select
                    $cod, $nome
                  from
                    $tabela
                  where
                    $nome like ('%{$request}%')
                  order by
                    $nome
                   ";

//        echo $sql;
        $linha=$_SESSION['ADOCnn']->Execute("$sql");
        if($linha->RecordCount() != 0 ){
           while(!$linha->EOF){
      			echo $linha->fields[0] . '###' . htmlentities(trim($linha->fields[1])) . '|';
               $linha->MoveNext();
           }

        }

}



live($request, $tabela, $cod, $nome);



?>



